<template>
<div>
  <el-descriptions :title="title" border style="width:590px" 
    
  >
    <el-descriptions-item label="医生名字"> {{ obj.userName }} </el-descriptions-item>
    <el-descriptions-item label="身份证号"> {{ obj.cardNo  }}</el-descriptions-item>
    <el-descriptions-item label="手机号"> {{ obj.phoneNum  }}</el-descriptions-item>
    <el-descriptions-item label="所在科室"> {{ depIdChangeName(options,obj.departmentId).depName }} </el-descriptions-item>
    <el-descriptions-item label="所在诊室"> {{ depIdChangeName(options1,obj.consultationRoomId).consName }}</el-descriptions-item>
    <el-descriptions-item label="说明">
      <el-tag size="small">
        {{ obj.remarks }}
      </el-tag>
    </el-descriptions-item>
    <!-- <el-descriptions-item label="主治疾病">江苏省苏州市吴中区吴中大道 江苏省苏州市吴中区吴中大道江苏省苏州市吴中区吴中大道江苏省苏州市吴中区吴中大道1188 号</el-descriptions-item> -->
  </el-descriptions>
</div>
</template>

<script>
import { getAllDepName,getZhenById } from '@/api/user'
export default {
  name: 'RecommmendedDoctor',
  props: {
    title: {
      type: String,
      default: '推荐医生信息'
    },
    obj:{
      type:Object,
      default:{}
    }
  },
  data(){
    return{
      options:[],
      options1:[]
    }
  },
 async mounted(){
   await this.getAllDepName()
    this.getZhenById()
  },
  methods:{
     // 所有科室信息
    async getAllDepName(){
      this.options = await getAllDepName()
    },
     // 通过id查询诊室信息
    async getZhenById(){
      // console.log(event)
      this.options1 = await getZhenById(this.obj.departmentId)
    },
    depIdChangeName(options,id){
       let name = {}
      options.forEach(item => {
        if(item.id == id){
          return name = item
        }
      } )
       return name
    }
  }
}
</script>

<style>

</style>
